// ============================== 导入依赖 ============================== //

import * as echarts from 'echarts'

export const COLOR = [
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    { offset: 0, color: 'rgba(44,117,229,.5)' },
    { offset: 0.8, color: '#fff' },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    { offset: 0, color: 'rgba(0,176,126,.5)' },
    { offset: 0.8, color: '#fff' },
  ]),
  new echarts.graphic.LinearGradient(0, 0, 0, 1, [
    { offset: 0, color: 'rgba(243,184,68,.5)' },
    { offset: 0.8, color: '#fff' },
  ]),
]

// ============================== 导出配置 ============================== //

export default {
  grid: {
    top: 40,
    left: 10,
    right: 16,
    bottom: 0,
    containLabel: true,
  },

  legend: {
    top: 6,
    right: 0,
    icon: 'roundRect',
    itemWidth: 16,
    itemHeight: 4,
    itemGap: 20,
    textStyle: {
      color: '#ccc',
    },
  },

  xAxis: {
    data: [],
    boundaryGap: false,
    axisTick: {
      show: false,
    },
    axisLabel: {
      color: '#aaa',
    },
    axisLine: {
      lineStyle: {
        color: '#999',
      },
    },
  },

  yAxis: {
    axisLabel: {
      color: '#aaa',
    },
    axisTick: {
      show: false,
    },
    splitLine: {
      show: false,
    },
  },

  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      label: {
        backgroundColor: '#409EFF',
        color: '#fff',
      },
    },
  },

  series: [
    {
      name: '当前量',
      type: 'line',
      smooth: 0.3,
      data: [],
      showSymbol: false,
      itemStyle: {
        color: '#2D75E5',
      },
      lineStyle: {
        width: 2,
        color: '#2D75E5',
        shadowColor: '#5D96EE',
        shadowBlur: 5,
        shadowOffsetY: 8,
      },
      areaStyle: {
        color: COLOR[0],
      },
    },
    {
      name: '昨日同期',
      type: 'line',
      smooth: 0.3,
      data: [],
      showSymbol: false,
      itemStyle: {
        color: '#00B07E',
      },
      lineStyle: {
        width: 2,
        color: '#00B07E',
        shadowColor: '#04f5b4',
        shadowBlur: 5,
        shadowOffsetY: 8,
      },
      areaStyle: {
        color: COLOR[1],
      },
    },
    {
      name: '去年同期',
      type: 'line',
      smooth: 0.3,
      data: [],
      showSymbol: false,
      itemStyle: {
        color: '#F3B844',
      },
      lineStyle: {
        width: 2,
        color: '#F3B844',
        shadowColor: '#E3C488',
        shadowBlur: 5,
        shadowOffsetY: 8,
      },
      areaStyle: {
        color: COLOR[2],
      },
    },
  ],
}
